<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	  xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:fn="http://java.sun.com/jsp/jstl/functions">
<h:head>
	<title>Aggiungi impiegato</title>
</h:head>
<h:body>

	<p:panel header="Aggiunta impiegato">
	
	<h:form id="navi">

		<h:panelGrid columns="2" cellpadding="5">
	        <p:commandButton value="Logout" action="#{loginManagedBean.logout()}" styleClass="ui-priority-primary" ajax="false"/>
	        <p:commandButton value="Indietro" action="home?faces-redirect=true" styleClass="ui-priority-primary" ajax="false"/>
		</h:panelGrid>
    </h:form>
            <h:form id="registrazione">
            <p:growl id="growl" showDetail="true" sticky="true" severity="info"/>  
            <h:panelGrid columns="3" cellpadding="5">
                <p:outputLabel value="Email:"/>
                <p:inputText id="email" value="#{employeeRegistrationManagedBean.registrazioneUtente.email}"
                	validator="prime.emailValidator"/>
                <p:message for="email" />

                <p:outputLabel value="Nome:"/>
                <p:inputText id="nome" value="#{employeeRegistrationManagedBean.registrazioneUtente.nome}"/>
                <p:message for="nome"/>

                <p:outputLabel value="Cognome:"/>
                <p:inputText id="cognome" value="#{employeeRegistrationManagedBean.registrazioneUtente.cognome}"/>
                <p:message for="cognome"/>
                
                <p:outputLabel value="Codice Fiscale:"/>
                <p:inputText id="codiceFiscale" value="#{employeeRegistrationManagedBean.registrazioneUtente.codiceFiscale}"
                	validator="prime.CFValidator" validatorMessage="Codice finscale non valido"/>
                <p:message for="codiceFiscale"/>

                <p:outputLabel value="Password:"/>
                <p:password id="password" value="#{employeeRegistrationManagedBean.registrazioneUtente.password}"
                            feedback="true" match="confermaPassword" label="Password"/>
                <p:message for="password"/>

                <p:outputLabel value="Conferma password:"/>
                <p:password id="confermaPassword" label="Conferma password"
                            value="#{employeeRegistrationManagedBean.registrazioneUtente.password}"
                            validator="prime.passwordValidatorPerModifica" validatorMessage="La password deve contenere almeno una lettera ed un numero ed essere compresa tra 8 e 32 caratteri" />
                <p:message for="confermaPassword" />
            </h:panelGrid>
            <h:panelGrid columns="1">
                <p:commandButton value="Aggiungi Impiegato" action="#{employeeRegistrationManagedBean.registra()}"
                                 styleClass="ui-priority-primary" ajax="false"/>
            </h:panelGrid>
        </h:form>
    </p:panel>
</h:body>
</html>